// components/product2/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    product: Object
  },

  /**
   * 组件的初始数据
   */
  data: {
    img: ''
  },

  /**
   * 组件的方法列表
   */
  methods: {
    detail() {
      wx.navigateTo({
        url: '../../../pages/mall/detail/index?productId=' +
          this.properties.product.productId,
      })
    }
  },
  attached() {
    if (this.properties.product.imgs != null && this.properties.product.imgs!='') {
      let imgs = this.properties.product.imgs.split(',')
      this.setData({
        img: imgs[0]
      })
    }
  }
})